//
//  WZVerticalButton.m
//  WZEfengAndEtong
//
//  Created by wanzhao on 16/6/19.
//  Copyright © 2016年 wanzhao. All rights reserved.
//

#import "WZVerticalButton.h"

@implementation WZVerticalButton

/**设置Button的frame*/
- (void)setupButton {
    
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
}

/**代码创建*/
- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame]) {
        
        [self setupButton];
    }
    return self;
}

/**从xib/sb 创建时*/
- (void)awakeFromNib {
    [super awakeFromNib];
    [self setupButton];
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    /**调整图片*/
    self.imageView.x = 0;
    self.imageView.y = 0;
    self.imageView.width = self.width;
    self.imageView.height = self.imageView.width;
    
    /**调整文字*/
    self.titleLabel.x = 0;
    self.titleLabel.y = self.imageView.height;
    self.titleLabel.width = self.width;
    self.titleLabel.height = self.height - self.titleLabel.y;
    
}

@end
